home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 4 / MacMania 4.toast / / Demo's / Igor Demo Pro / 1 PutContentsIn Igor Pro Folder / WaveMetrics Procedures / Graphing / Axis Utilities < prev    next >
Text File  |  1994-02-18  |  1KB  |  65 lines

  1. | Axis Utilities
  2.  
  3. #include <Strings as Lists>
  4.  
  5. Function/S HVAxisList(graphNameStr,wantHorizAxes)
  6.     String graphNameStr;Variable wantHorizAxes
  7.     
  8.     String hvlist="",axlist,inf
  9.     String axis
  10.     Variable index=0
  11.     
  12.     axlist=AxisList(graphNameStr)
  13.     
  14.     do
  15.         axis= GetStrFromList(axlist, index, ";")
  16.         if (strlen(axis) == 0)
  17.             break                                | ran out of items
  18.         endif
  19.         inf=AxisInfo(graphNameStr,axis)
  20.         if( AxisOrientation(inf,wantHorizAxes) )
  21.             hvlist += axis + ";"
  22.         endif
  23.         index += 1
  24.     while (1)        | loop until break above
  25.     return hvlist
  26. End
  27.  
  28. | Returns 1 if axis has desired orientation, else returns 0
  29. Function AxisOrientation(axisInfo,wantHorizAxes)
  30.     String axisInfo;Variable wantHorizAxes
  31.  
  32.     if( wantHorizAxes )
  33.         if( strsearch(axisInfo,"AXTYPE:bottom;",0) < 0 )
  34.             if( strsearch(axisInfo,"AXTYPE:top;",0) < 0 )
  35.                 return 0
  36.             endif
  37.         endif
  38.     else
  39.         if( strsearch(axisInfo,"AXTYPE:left;",0) < 0 )
  40.             if( strsearch(axisInfo,"AXTYPE:right;",0) < 0 )
  41.                 return 0
  42.             endif
  43.         endif
  44.     endif
  45.  
  46.     return 1
  47. End
  48.  
  49. | returns axis units, which often are ""
  50. Function/S AxisUnits(axis)
  51.     String axis
  52.     String inf,units=""
  53.     Variable st,en
  54.     
  55.     inf=AxisInfo("",axis)
  56.     st= strsearch(inf,"UNITS:",0)
  57.     if( st >= 0 )
  58.         en= strsearch(inf,";",st)
  59.         if( en > st )
  60.             units=inf[st+6,en-1]
  61.         endif
  62.     endif
  63.     return units
  64. End
  65.